<script>
  export default {
    data() {
      return {
        activeIndex: 'workbench',
        user: {}
      }
    },
    methods: {
      handleClick() {
        this.$router.push('/cc')
      },

      logout() {
        // 清除缓存数据，假设缓存数据存储在 localStorage 中
        localStorage.clear();
        // 跳转到登录页面
        this.$router.push('/login');

      },
      ai(){
        this.$router.push("/ai")
      },
      tz(){
        this.$router.push('/jmgl')
      }
  },
  created() {
    var u = localStorage.getItem("user");

    if (u!=null) {
      this.user = JSON.parse(u);
    }else {
      this.$router.push("/login")
    }
  }
}
</script>

<template>
  <div>

<!--    <div class="top-nav">-->
<!--      &lt;!&ndash; 顶部导航栏内容 &ndash;&gt;-->
<!--      <el-row>-->
<!--        <h3 align="left"  style="margin-left: 25px">家医后台管理系统</h3>-->
<!--&lt;!&ndash;        <el-col :span="12">Daisy Axure 家医后台管理系统</el-col>&ndash;&gt;-->
<!--&lt;!&ndash;        <el-col :span="12">早上好!Daisy</el-col>&ndash;&gt;-->
<!--        <el-submenu index="userData">-->
<!--          <template slot="title">用户</template>-->
<!--          <el-menu-item index="personalData">我的资料</el-menu-item>-->
<!--          <el-menu-item index="changePassword">重置密码</el-menu-item>-->
<!--          <el-menu-item index="logout">退出系统</el-menu-item>-->
<!--        </el-submenu>-->
<!--      </el-row>-->
<!--    </div>-->

    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" style="background-color: #f3f0f0;z-index: 99; position: fixed; width: 100%;">
      <h2  style="float: left; margin-left: 25px; margin-top: 8px">家医后台管理系统</h2>
      <el-submenu index="userData" style="float: right; margin-right: 25px">
        <template slot="title">用户</template>
        <el-menu-item index="personalData">
          <router-link tag="div" to="/profile">我的资料</router-link>
        </el-menu-item>
        <el-menu-item index="changePassword">
          <router-link tag="div" to="/reset">重置密码</router-link>
        </el-menu-item>
        <el-menu-item index="logout" @click="logout">退出系统</el-menu-item>
      </el-submenu>
    </el-menu>

    <el-row class="tac">
      <el-col :span="3" style="position:fixed" >
        <el-menu :default-active="activeIndex" class="el-menu-vertical" style=" background-color: #f3f0f0;">
          <br>
          <br>
          <br>
          <el-menu-item index="workbench">
            <router-link tag="div" to="/workbench">工作台</router-link>
          </el-menu-item>
          <el-submenu index="signManagement">
            <template slot="title">⭐签约管理</template>
            <!--            <el-menu-item index="pendingSign" @click="handleClick">待处理签约</el-menu-item>-->
            <el-menu-item index="pendi ngSign">
              <router-link tag="div" to="/qy">待处理签约</router-link>
            </el-menu-item>
            <el-menu-item index="signRecord" v-if="user.role==0">
              <router-link tag="div" to="/jl" >签约记录</router-link>
            </el-menu-item>
          </el-submenu>
          <el-submenu index="serviceManagement">
            <template slot="title">⭐服务管理</template>
            <el-menu-item index="pendingSign">
              <router-link tag="div" to="/fw">服务管理</router-link>
            </el-menu-item>
            <el-menu-item index="pendingSign" v-if="user.role==0">
              <router-link tag="div" to="/sr">服务记录</router-link>
            </el-menu-item>
<!--            <el-menu-item index="serviceRecord">服务记录</el-menu-item>-->
          </el-submenu>
          <el-menu-item index="residentManagement">
            <router-link tag="div" to="/jmgl">⭐居民管理</router-link>
          </el-menu-item>
<!--          <el-menu-item index="messageManagement">-->
<!--            <router-link tag="div" to="/message" v-if="user.role==0">⭐消息管理</router-link>-->
<!--          </el-menu-item>-->
          <el-submenu index="dataManagement" v-if="user.role==0">
            <template slot="title">⭐资料管理</template>
            <el-menu-item index="residentData">
              <router-link to="/jg" tag="div">机构管理</router-link>
            </el-menu-item>
            <el-menu-item index="teamData">
              <router-link to="/team" tag="div">团队管理</router-link>
            </el-menu-item>
            <el-menu-item index="doctorData">
              <router-link to="/doctor" tag="div">医生管理</router-link>
            </el-menu-item>
            <el-menu-item index="servicePackageData">
              <router-link to="/fwb" tag="div">服务包管理</router-link>
            </el-menu-item>
            <el-menu-item index="serviceItemData">
              <router-link tag="div" to="/xmgl">服务项目管理</router-link>
            </el-menu-item>
<!--            <el-menu-item index="performanceData">业绩目标管理</el-menu-item>-->

          </el-submenu>
<!--          <el-submenu index="dataStatistics" v-if="user.role==0">-->
<!--            <template slot="title">⭐数据统计</template>-->
<!--            <el-menu-item index="dataOverview">数据概况</el-menu-item>-->
<!--            <el-menu-item index="signPerformanceStatistics">签约业绩统计</el-menu-item>-->
<!--            <el-menu-item index="servicePerformanceStatistics">服务业绩统计</el-menu-item>-->
<!--            <el-menu-item index="healthStatistics">居民健康异常统计</el-menu-item>-->
<!--            <el-menu-item index="tagStatistics">居民标签统计</el-menu-item>-->
<!--            <el-menu-item index="ageStatistics">居民年龄统计</el-menu-item>-->
<!--            <el-menu-item index="educationStatistics">-->
<!--              <router-link tag="div" to="/education_statistics">居民学历统计</router-link>-->
<!--            </el-menu-item>-->
<!--            <el-menu-item index="genderStatistics">居性别统计</el-menu-item>-->
<!--          </el-submenu>-->
          <el-submenu index="systemSettings" v-if="user.role==0">
            <template slot="title" >⭐系统设置</template>
            <el-menu-item index="userManagement">
              <router-link tag="div" to="/Management" >标签管理</router-link></el-menu-item>
            <el-menu-item index="roleManagement">
              <router-link tag="div" to="/role" >角色管理</router-link>
            </el-menu-item>
            <el-menu-item index="menuManagement">
              <router-link tag="div" to="/settings_information" >资讯管理</router-link>
            </el-menu-item>
            <el-menu-item index="departmentManagement">
              <router-link tag="div" to="/settings_drug">药品管理</router-link>
            </el-menu-item>
            <el-menu-item index="carouselManagement">
              <router-link tag="div" to="/slideshow">轮播图管理</router-link>
            </el-menu-item>
            <el-menu-item index="noticeManagement">
              <router-link tag="div" to="/notice">系统公告</router-link>
            </el-menu-item>
            <el-menu-item index="contractManagement">
              <router-link tag="div" to="/xieyi">协议管理</router-link>
            </el-menu-item>
            <el-menu-item index="operationLog">
              <router-link tag="div" to="/operation_log">操作日志</router-link>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-col>

<!--      <el-container style="margin-left: 235px; margin-top: 120px; width: 80%; height: 100vh; " >-->
<!--        <div style=" width: 100%; height: 100%;">-->
<!--          <router-view/>-->
<!--        </div>-->
<!--      </el-container>-->
      <el-container style="margin-left:235px; margin-top: 60px">
        <router-view/>
      </el-container>
    </el-row>





  </div>
</template>

<style>

.el-menu-vertical {

  //height: 100vh;
  //overflow-y: auto;
  //background-color: #f8f8f8;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  background-color: #f8f8f8;
}

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


</style>
